home *** CD-ROM | disk | FTP | other *** search
- /* example of Rename */
-
- OPTIONS RESULTS
- OPTIONS FAILAT 20
- SIGNAL ON FAILURE
-
- ADDRESS MEGAD
- dbug
-
- /* First, we need to make sure that the items are sorted by Name */
- "MenuCheck 'show,sort on,name' Check"
- directory = ARG(1)
- if directory = '' then exit
- /*******************************************************************************
- The directory argument can be sent in one of two ways
- Selected Directory in MegaD window
- ARexx Gadget Program Control should have only the below two items checked
- Skip selected files
- Skip .info files
- and the Path and Program name should be the correct path to this script.
- This will require the user to select at least one directory to rename
- every other file to have an underscore in front of it.
- User Input required
- ARexx Gadget Program Control should have only the below five items checked
- Skip select4d directories
- Skip selected files
- work without selected items
- skip .info files
- Query for 'Flags to add'
- and the Path and Program name should be the correct path to this script.
- This method will require a valid Path to the correct directory to
- be typed by the user.
- *******************************************************************************/
-
- CloseWindows /* close any open windows */
- Mark directory /* open the ram disk */
- IF RESULT = '' then exit
- SelectAll /* select everything */
-
- /* disable directory sorting or we will be rename files renamed once before */
- "MenuCheck 'show,sort on,none' Check"
-
- DO FOREVER
- NextItem Filename
- if result = "" then leave
- ELSE DO
- name = '_' || result
- Rename name /* Rename will unselect the first selected item */
- END
- /* skip the next selected item */
- NextItem Filename clear /* unselect the next item too */
- IF RESULT = "" then leave
- END
-
- /* re-enable the sorting on Name */
- "MenuCheck 'show,sort on,name' Check"
- /* force and update of the window */
- "Menu 'show,Reset All'"
-
- exit
-
- failure:
- if RC ~= 0 then say "Script Failed, RC = " RC
- exit
-
-